package box.tuson.com.tusonbox;
import android.app.*;
import android.os.*;
import java.util.*;
import android.content.*;
import android.graphics.*;
import android.widget.*;
import android.view.*;
import android.content.pm.*;

public class Load extends Activity
{
	public static Typeface chineseTypeface,englishTypeface ;
	private TextView box,bb;
	@Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置成全屏模式
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖屏
        setContentView(R.layout.load);
		box = (TextView) findViewById(R.id.loadTextView1);
		bb = (TextView) findViewById(R.id.loadTextView2);
		enterHome();
		initTypeFace(getApplicationContext());
}
	private void initTypeFace(Context context) {
        
        englishTypeface = Typeface.createFromAsset(context.getAssets(),
												   "font/Roboto-Light.ttf");
        chineseTypeface = Typeface.createFromAsset(context.getAssets(),
		                                           "font/xiyuan.ttf");

		//设置字体风格										   
        box.setTypeface(Load.chineseTypeface);
		bb.setTypeface(Load.englishTypeface);
		}
		
	private void enterHome(){
		Timer time = new Timer();
		TimerTask tk = new TimerTask() {
			Intent intent = new Intent(Load.this,Main.class);
			@Override
			public void run() {
				startActivity(intent);
				finish();
			}
		};time.schedule(tk, 2000);
	}
	@Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        //判断是否有焦点
        if(hasFocus && Build.VERSION.SDK_INT >= 19){
            View decorView = getWindow().getDecorView();
            decorView.setSystemUiVisibility(
				View.SYSTEM_UI_FLAG_LAYOUT_STABLE
				|View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
				|View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
				|View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
				|View.SYSTEM_UI_FLAG_FULLSCREEN
				|View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            );
}}
}
